package cn.edu.scau.cmi.wujiaxian.exercise9;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Example9_19 {
	
	public static void main(String[] args) {
		String regex = "(http://|www)\56?\\w+\56{1}\\w+\56{1}\\p{Alpha}+";
		Pattern p = Pattern.compile(regex);
		String s = "清华大学网址:www.tsinghua.edu.cn,邮电出版社的网址:http://www.ptpress.com";
		Matcher m = p.matcher(s);
		while (m.find()) {
			String str = m.group();
			System.out.println(str);
		}
		String result = m.replaceAll("");
		System.out.println(result);
	}
	
}
